#ifndef __MACRO_POKER_FACTORY_H__
#define __MACRO_POKER_FACTORY_H__

#include <string>
#include <memory>

#define DEFINE_TYPE_AND_REGISTER(TYPE) do {           \
    class TYPE                                        \
    {                                                 \
    public:                                           \
        TYPE() {}                                     \
        ~TYPE() {}                                    \
    };                                                \
    typedef TYPE::UPtr (*Generator)();                \
    std::map<std::string, Generator> g_##TYPE##Factory = {};  \
    TYPE::UPtr Func_##TYPE##_Generator()   \
    {                                      \
        return std::make_unique<TYPE>();   \
    }                                      \
    class TYPE##Register                   \
    {                                      \
    public:                                \
        TYPE##Register(const std::string& name, Generator generator)   \
        {                                                              \
            g_##TYPE##Factory.insert(std::make_pair(name, generator)); \
        }                                                              \
    };                                                                 \
    TYPE##Register g_##TYPE##Register(#TYPE, Func_##TYPE##_Generator); \
} while (0)


namespace poker
{
namespace base
{

} // namespae base
} // namespace poker

#endif // __MACRO_POKER_FACTORY_H__